import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView,
        redirect: '/menu',
        children: [
            {
                path: '/user',
                component: () =>
                    import('../views/user/UserView.vue'),
                redirect: '/user/info',
                children: [
                    {
                        path: 'info', component: () =>
                            import('../views/user/UserInfo.vue')
                    },
                    {
                        path: 'update', component: () =>
                            import('../views/user/UserUpdate.vue')
                    },
                    {
                        path: 'course', component: () =>
                            import('../views/user/UserCourse.vue')
                    },
                    {
                        path: 'comment', component: () =>
                            import('../views/user/UserComment.vue')
                    }
                ]
            },
            {path: '/order', component: () => import('@/views/order/OrderView.vue')},
            {path: '/menu', component: () => import('@/views/menu/MenuVue.vue')},
            {path: '/teacher', component: () => import('@/views/teacher/Teachers.vue')},
            {path: '/news1', component: () => import('@/views/news/News1.vue')},
            {path: '/news2', component: () => import('@/views/news/News2.vue')},
            {path: '/news3', component: () => import('@/views/news/News3.vue')},
            {path: '/news4', component: () => import('@/views/news/News4.vue')},
            {path: '/news5', component: () => import('@/views/news/News5.vue')},
            {path: '/FreeCourse', component: () => import('@/views/courses/FreeCourse.vue')},
            {path: '/LiveCourse', component: () => import('@/views/courses/LiveCourse.vue')},
            {path: '/PremiumCourse', component: () => import('@/views/courses/PremiumCourse.vue')},
            {path: '/notice', component: () => import('@/views/other/Notice.vue')},
            {path: '/warn', component: () => import('@/views/other/Warn.vue')},
        ]
    },
    {path: '/login', component: () => import('../views/LoginView')}
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router